< previous page page_576 next page >

Page 576
9f31265bb40b592b1929e18a47ab28e5.gif
      ' Get Operating System
      Call OSystemGet
   End If
End Sub
The MEMORYSTATUS user-defined type is passed to the GlobalMemoryStatus() function and filled in with memory information. The SYSTEM_INFO user-defined type is passed to the GetSystemInfo() function to retrieve information on the number of processors and processor types.
The Windows Directory Properties
You can also retrieve the directory where Windows is installed as well as the Windows\System directory and the directory to which your TEMP variable is set. Three properties call the WinDirInfo() method to get this information. You can use these properties, for example, to find a particular DLL that you know must reside in the Windows or Windows\System directory. Also, you might need to create a temporary file for your application, and the best place to create this file is where the user has set the location of his or her Temp directory. Heres the code:
9f31265bb40b592b1929e18a47ab28e5.gif
Public Property Get WinDir() As String
   Call WinDirInfo
   WinDir = mstrWinDir
End Property

Public Property Get WinSysDir() As String
   Call WinDirInfo
   WinSysDir = mstrWinSysDir
End Property

Public Property Get WinTempDir() As String
   Call WinDirInfo
   WinTempDir = mstrWinTempDir
End Property
Notice that the WinDirInfo() method is called in each of the Property Get procedures. This ensures that the information is up-to-date when its retrieved. However, in the WinDirInfo() method, you can see that the actual routines are only called once. Because this information does not change, theres no need to keep making these Windows API calls.

 
< previous page page_576 next page >

If you like this book, buy it!